import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "login",
    component: () =>
      import(/* webpackChunkName: "index" */ "../views/login.vue"),
    meta: {
      title: "易为教育登录界面",
      keepAlive: false
    }
  },
  {
    path: "/user",
    name: "user",
    meta: {
      keepAlive: false
    },
    component: { render: h => h("router-view") },
    children: [
      {
        path: "sum",
        name: "sum",
        meta: {
          title: "提成结算页面",
          keepAlive: false
        },
        component: () =>
          import(/* webpackChunkName: "user" */ "../views/user/sum.vue")
      },
      {
        path: "list",
        name: "list",
        meta: {
          title: "签约学生列表页面",
          keepAlive: false
        },
        component: () =>
          import(/* webpackChunkName: "user" */ "../views/user/list.vue")
      },
      {
        path: "detail",
        name: "userDetail",
        redirect: "detail/index",
        meta: {
          title: "",
          keepAlive: false
        },
        component: { render: h => h("router-view") },
        children: [
          {
            path: "index",
            name: "index",
            meta: {
              title: "签约学生资料",
              keepAlive: false
            },
            component: () =>
              import(
                /* webpackChunkName: "user" */ "../views/user/detail/index.vue"
              )
          },
          {
            path: "info",
            name: "info",
            meta: {
              title: "签约学生信息",
              keepAlive: false
            },
            component: () =>
              import(
                /* webpackChunkName: "user" */ "../views/user/detail/userInfo.vue"
              )
          },
          {
            path: "idCard",
            name: "idCard",
            meta: {
              title: "签约学生身份证照片",
              keepAlive: false
            },
            component: () =>
              import(
                /* webpackChunkName: "user" */ "../views/user/detail/idCard.vue"
              )
          },
          {
            path: "photo",
            name: "photo",
            meta: {
              title: "签约学生电子证件照片",
              keepAlive: false
            },
            component: () =>
              import(
                /* webpackChunkName: "user" */ "../views/user/detail/photo.vue"
              )
          },
          {
            path: "graduatePhoto",
            name: "graduatePhoto",
            meta: {
              title: "签约学生毕业证书照片",
              keepAlive: false
            },
            component: () =>
              import(
                /* webpackChunkName: "user" */ "../views/user/detail/graduatePhoto.vue"
              )
          },
          {
            path: "apply",
            name: "apply",
            meta: {
              title: "发票申请基本信息填写",
              keepAlive: false
            },
            component: () =>
              import(
                /* webpackChunkName: "user" */ "../views/user/detail/apply.vue"
              )
          }
        ]
      }
    ]
  },
  {
    path: "/form",
    name: "form",
    component: () =>
      import(/* webpackChunkName: "form" */ "../views/index.vue"),
    meta: {
      title: "易为教育2021年学历报名表",
      keepAlive: false
    }
  },
  {
    path: "/detail",
    name: "detail",
    component: () =>
      import(/* webpackChunkName: "detail" */ "../views/detail.vue"),
    meta: {
      title: "付款信息",
      keepAlive: false
    }
  },
  {
    path: "*",
    name: "404",
    component: () =>
      import(/* webpackChunkName: "detail" */ "../views/404.vue"),
    meta: {
      title: "404",
      keepAlive: false
    }
  }
];

const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes
});
// router.beforeEach()
export default router;
